﻿using System;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.VR;

namespace RootMotion.Demos
{
	// Token: 0x020000D5 RID: 213
	public class VRSetup : MonoBehaviour
	{
		// Token: 0x17000092 RID: 146
		// (get) Token: 0x0600063D RID: 1597 RVA: 0x00006057 File Offset: 0x00004257
		// (set) Token: 0x0600063E RID: 1598 RVA: 0x0000605F File Offset: 0x0000425F
		public bool isFinished { get; set; }

		// Token: 0x0600063F RID: 1599 RVA: 0x000393B4 File Offset: 0x000375B4
		public void Awake()
		{
			foreach (GameObject gameObject in this.enableOnR)
			{
				gameObject.SetActive(false);
			}
			Cursor.lockState = CursorLockMode.Locked;
			if (this.characterController != null)
			{
				this.moveSpeed = this.characterController.moveSpeed;
				this.characterController.moveSpeed = 0f;
			}
		}

		// Token: 0x06000640 RID: 1600 RVA: 0x00039420 File Offset: 0x00037620
		public void LateUpdate()
		{
			if (Input.GetKeyDown(KeyCode.Escape))
			{
				Application.Quit();
			}
			if (!this.isFinished && this.characterController != null)
			{
				this.characterController.transform.rotation = Quaternion.identity;
			}
			if (Input.GetKeyDown(KeyCode.R))
			{
				foreach (GameObject gameObject in this.enableOnR)
				{
					gameObject.SetActive(true);
				}
				InputTracking.Recenter();
				this.text.gameObject.SetActive(false);
				if (this.characterController != null)
				{
					if (!this.disableMovement)
					{
						this.characterController.moveSpeed = this.moveSpeed;
					}
					this.characterController.transform.position += Vector3.up * 0.001f;
				}
				this.isFinished = true;
			}
		}

		// Token: 0x0400056A RID: 1386
		public Text text;

		// Token: 0x0400056B RID: 1387
		public GameObject model;

		// Token: 0x0400056C RID: 1388
		public GameObject[] enableOnR;

		// Token: 0x0400056D RID: 1389
		public VRCharacterController characterController;

		// Token: 0x0400056E RID: 1390
		public bool disableMovement;

		// Token: 0x0400056F RID: 1391
		public float moveSpeed;
	}
}
